package com.ccx.coachsite.versionupdate;


import android.graphics.Color;
import android.os.Bundle;
import android.preference.Preference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;
import android.view.Window;

import com.ccx.coachsite.R;


public class SoftUpdateSettingActivity extends PreferenceActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		super.onCreate(savedInstanceState);
		// 设置对应需要修改的配置文件
		getPreferenceManager().setSharedPreferencesName(SoftVersionUtils.VERSION_UPDATE_SETTING_NAME);
		// 引用配置内容xml文件
		addPreferencesFromResource(R.xml.soft_update_setting_preferences);
		this.getListView().setCacheColorHint(Color.parseColor("#00000000"));
	}

	@Override
	public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
		if(preference.getKey()!=null && "key_version_description".equalsIgnoreCase(preference.getKey())){
			//VersionUpdateUtil.createVersionUpdateUtil(this).show();
		}else if(preference.getKey()!=null && "key_check_version".equalsIgnoreCase(preference.getKey())){
			SoftUpdateTask task = new SoftUpdateTask(this, true);
			task.execute();
		}
		return super.onPreferenceTreeClick(preferenceScreen, preference);
	}
	
}
